import java.util.Arrays;

public class toPoint {
    public static void main(String[] args) {
        int[] a = new int[50];
        for (int i = 0; i < a.length; i++) {
            a[i] = i;
        }
        System.out.println(Arrays.toString(twoSum2(a,48)));
    }

    public static int[] twoSum2(int[] array, int target) {
        int[] result = new int[59];
        if (array == null || array.length == 0) {
            return result;
        }
        int i = 0;
        int start = 0;
        int end = array.length - 1;
        while (start < end) {
            if (array[start] + array[end] < target) {
                start++;
            } else if (array[start] + array[end] > target) {
                end--;
            } else {
                result[i] = start;
                result[i+1] = end;
                i=i+2;
                end--;
            }
        }
        return result;

    }
}